home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 December / maximum-cd-2009-12.iso / DiscContents / gimp-2.7.0-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / old-photo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2009-08-19  |  3.4 KB  |  109 lines

  1. ;
  2. ; old-photo
  3. ;
  4. ;
  5. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  6. ; At ECS Dept, University of Southampton, England.
  7.  
  8. ; This program is free software: you can redistribute it and/or modify
  9. ; it under the terms of the GNU General Public License as published by
  10. ; the Free Software Foundation; either version 3 of the License, or
  11. ; (at your option) any later version.
  12. ;
  13. ; This program is distributed in the hope that it will be useful,
  14. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. ; GNU General Public License for more details.
  17. ;
  18. ; You should have received a copy of the GNU General Public License
  19. ; along with this program.  If not, see <http://www.gnu.org/licenses/>.
  20. ;
  21. ; Branko Collin <collin@xs4all.nl> added the possibility to change
  22. ; the border size in October 2001.
  23.  
  24. ; Define the function:
  25.  
  26. (define (script-fu-old-photo inImage inLayer inDefocus inBorderSize inSepia inMottle inCopy)
  27.   (let (
  28.        (theImage 0)
  29.        (theLayer 0)
  30.        (theWidth 0)
  31.        (theHeight 0)
  32.        )
  33.   (gimp-image-undo-group-start inImage)
  34.   (gimp-selection-all inImage)
  35.   (set! theImage (if (= inCopy TRUE)
  36.                      (car (gimp-image-duplicate inImage))
  37.                      inImage)
  38.   )
  39.  
  40.   (set! theLayer (car (gimp-image-flatten theImage)))
  41.   (if (= inDefocus TRUE)
  42.       (plug-in-gauss-rle RUN-NONINTERACTIVE theImage theLayer 1.5 TRUE TRUE)
  43.   )
  44.   (if (> inBorderSize 0)
  45.       (script-fu-fuzzy-border theImage theLayer '(255 255 255)
  46.                               inBorderSize TRUE 8 FALSE 100 FALSE TRUE )
  47.   )
  48.   (set! theLayer (car (gimp-image-flatten theImage)))
  49.  
  50.   (if (= inSepia TRUE)
  51.       (begin (gimp-desaturate theLayer)
  52.              (gimp-brightness-contrast theLayer -20 -40)
  53.              (gimp-color-balance theLayer 0 TRUE 30 0 -30)
  54.       )
  55.   )
  56.   (set! theWidth (car (gimp-image-width theImage)))
  57.   (set! theHeight (car (gimp-image-height theImage)))
  58.   (if (= inMottle TRUE)
  59.       (let (
  60.         (mLayer (car (gimp-layer-new theImage theWidth theHeight
  61.                      RGBA-IMAGE "Mottle"
  62.                      100 DARKEN-ONLY-MODE)))
  63.         )
  64.  
  65.              (gimp-image-add-layer theImage mLayer 0)
  66.              (gimp-selection-all theImage)
  67.              (gimp-edit-clear mLayer)
  68.              (gimp-selection-none theImage)
  69.              (plug-in-noisify RUN-NONINTERACTIVE theImage mLayer TRUE 0 0 0 0.5)
  70.              (plug-in-gauss-rle RUN-NONINTERACTIVE theImage mLayer 5 TRUE TRUE)
  71.              (set! theLayer (car (gimp-image-flatten theImage)))
  72.       )
  73.   )
  74.  
  75.  
  76.  
  77.   (if (= inCopy TRUE)
  78.       (begin  (gimp-image-clean-all theImage)
  79.               (gimp-display-new theImage)
  80.       )
  81.   )
  82.   (gimp-selection-none inImage)
  83.   (gimp-image-undo-group-end inImage)
  84.   (gimp-displays-flush theImage)
  85.   )
  86. )
  87.  
  88. (script-fu-register "script-fu-old-photo"
  89.   _"_Old Photo..."
  90.   _"Make an image look like an old photo"
  91.   "Chris Gutteridge"
  92.   "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
  93.   "16th April 1998"
  94.   "RGB* GRAY*"
  95.   SF-IMAGE      "The image"     0
  96.   SF-DRAWABLE   "The layer"     0
  97.   SF-TOGGLE     _"Defocus"      TRUE
  98.   SF-ADJUSTMENT _"Border size"  '(20 0 300 1 10 0 1)
  99.      ; since this plug-in uses the fuzzy-border plug-in, I used the
  100.      ; values of the latter, with the exception of the initial value
  101.      ; and the 'minimum' value.
  102.   SF-TOGGLE     _"Sepia"        TRUE
  103.   SF-TOGGLE     _"Mottle"       FALSE
  104.   SF-TOGGLE     _"Work on copy" TRUE
  105. )
  106.  
  107. (script-fu-menu-register "script-fu-old-photo"
  108.                          "<Image>/Filters/Decor")
  109.